﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.woodsoft.core;
using com.woodsoft.core.Files;
using System.Text.RegularExpressions;
using EQ1.Elements;
using EQ1.Objects;

namespace EQ1.Elements {
	public class TextureInfo : UIClass, IUIElement<TextureInfo> {
    public TextureInfo ( UIDocument doc , string name ) : base( doc , name ) {
    }
		public TextureInfo ( UIDocument doc )
			: this(doc, "TextureInfo") {
		}

    #region IUIElement<ButtonDrawTemplate> Members

    public void Copy ( TextureInfo val ) {
      base.Copy( val );

      this.Size = val.Size;
    }
    public void Validate ( TextureInfo val , string name ) {
      UIClass par = ( UIClass ) this.ParentNode;

      if( val.LocalName != name ) {
        TextureInfo el = new TextureInfo( ( UIDocument ) val.OwnerDocument , name );
        el.Copy( val );
        val = el;
      }

      if( par.GetElement( name ) != null )
        par.RemoveElement( name );

      par.AppendChild( val );
    }

    #endregion
    
    public UISize Size {
      get {
        return ( UISize ) this.GetElement( "Size" );
      }
      set {
        this.Size.Validate( value , "Size" );
      }
    }

	}
}
